<?php
class Msg extends AppModel
{
    var $name = 'Msg';
    var $primaryKey = 'id'; 
    var $order = array("Msg.created" => "desc");

  /*  var $belongsTo = array(
        'User_msg_relationship' => array(
            'conditions' => array("User_msg_relationship.id_two=Msg.id and User_msg_relationship.id_one='' and User_msg_relationship.relationship='message'"),
           // 'fields' => "Msg.subject,Msg.content",
            'className'    => 'User_msg_relationship',
            'foreignKey'    => ''
        ));*/
    //企业信息中截止日期到期提醒功能    
 	function addalertmsg($mydata = array()){
 		if (!empty($mydata)){
 			$this->data['Msg']['subject'] = $mydata['subject'];
 			$this->data['Msg']['content'] = $mydata['content'];
 			$this->data['Msg']['owner_id'] = $mydata['owner_id'];
 			$this->data['Msg']['is_readed'] = $mydata['is_readed'];
 			$this->data['Msg']['has_feedback'] = $mydata['has_feedback'];
 			$this->data['Msg']['auto_sys'] = $mydata['auto_sys'];
 			$this->data['Msg']['id_deleted'] = $mydata['id_deleted'];
 			
 			if ($this->save($this->data['Msg'])){
 				return $this->getLastInsertId();	
 			}else{
 				return false;
 			}
 		}else{
 			return false;
 		}
 	}
}
?>